package com.ticket.sass.admin.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ticket.sass.admin.business.MemberCardBusiness;
import com.ticket.sass.admin.dto.input.member.MemberCardListInput;
import com.ticket.sass.admin.dto.input.member.MemberCardOrderRecordListInput;
import com.ticket.sass.admin.dto.output.member.MemberCardListOutput;
import com.ticket.sass.admin.dto.output.member.MemberCardOrderRecordListOutput;
import com.ticket.sass.admin.model.PageModel;
import com.ticket.sass.admin.model.ResultModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 会员卡级别 前端控制器
 * </p>
 *
 * @author ywb
 * @since 2024-03-06
 */
@RestController
@AllArgsConstructor
@ApiSupport(order = 12)
@Api(tags = {"会员卡-模块"})
@RequestMapping("/member-cards")
public class MemberCardController {
    MemberCardBusiness memberCardBusiness;
    
    @ApiOperation("列表")
    @GetMapping
    public ResultModel<PageModel<MemberCardListOutput>> list(
        @Valid MemberCardListInput input
    ) {
        return ResultModel.success(
            memberCardBusiness.list(input)
        );
    }
    
    @ApiOperation("交易记录")
    @GetMapping("/order-records")
    public ResultModel<PageModel<MemberCardOrderRecordListOutput>> orderRecordList(
        @Valid MemberCardOrderRecordListInput input
    ) {
        return ResultModel.success(
            memberCardBusiness.orderRecordList(input)
        );
    }
}
